<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-if</title>
    <script src="/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <h2>天气</h2>
      <p v-if="weather">热</p>
      <p v-if="!weather">冷</p>
      <button @click="changeWeather">change</button>
    </div>
    <script>
      Vue.config.productionTip = false;
      const vm = new Vue({
        el: "#app",
        data() {
          return {
            weather: true
          };
        },
        methods: {
          changeWeather() {
            this.weather = !this.weather
          }
        }
      });
    </script>
  </body>
</html>
